package com.crm.service.impl.companyInvoiceManager;

import com.crm.dao.mapper.companyInvoiceManager.SysCompanyInvoiceMapper;
import com.crm.dao.mapper.customMapper.companyInvoiceManager.CompanyInvoiceMapper;
import com.crm.model.entity.companyInvoiceManager.SysCompanyInvoice;
import com.crm.model.vo.companyInvoiceManager.CompanyInvoiceListPageVO;
import com.crm.model.vo.companyInvoiceManager.CompanyInvoiceVO;
import com.crm.service.companyInvoiceManager.CompanyInvoiceDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:chaifuyou
 * @Date: 2021/4/26 10:17
 */
@Service
public class CompanyInvoiceDbServiceImpl implements CompanyInvoiceDbService {

    @Autowired
    private CompanyInvoiceMapper companyInvoiceMapper;

    @Autowired //自动生成
    private SysCompanyInvoiceMapper sysCompanyInvoiceMapper;

    /**
     * 根据当前登录人公司获取该公司可以选择开发票的公司列表
     * @param companyId
     * @return
     */
    @Override
    public List<CompanyInvoiceVO> getCompanyListByCompanyId(String companyId) {
        return companyInvoiceMapper.getCompanyListByCompanyId(companyId);
    }

    /**
     * 税盘管理列表
     * @param companyName
     * @return
     */
    @Override
    public List<CompanyInvoiceListPageVO> getCompanyList(String companyName) {
        return companyInvoiceMapper.getCompanyList(companyName);
    }

    /**
     * 根据公司id 删除税盘设置
     * @param companyId
     */
    @Override
    public void delTaxDisc(String companyId) {
        companyInvoiceMapper.delTaxDisc(companyId);
    }

    /**
     * 添加税盘设置
     * @param sysCompanyInvoice
     */
    @Override
    public void saveTaxDisc(SysCompanyInvoice sysCompanyInvoice) {
        sysCompanyInvoiceMapper.insertSelective(sysCompanyInvoice);
    }

    /**
     * 查询是否税盘
     * @param companyId
     * @return
     */
    @Override
    public Integer selectTaxCountByCompanyId(String companyId) {
        return companyInvoiceMapper.selectTaxCountByCompanyId(companyId);
    }
}
